#include <stdio.h>


char *
simple_strpbrk (const char *s, const char *rej)
{
	const char *r;
	char c;
	
	while ((c = *s++) != '\0')
		for (r = rej; *r != '\0'; ++r)
			if (*r == c)
				return (char *) s - 1;
			return NULL;
}

/* Find the first occurrence in S of any character in ACCEPT.  */
char *
strpbrk (s, accept)
const char *s;
const char *accept;
{
	while (*s != '\0')
	{
		const char *a = accept;
		while (*a != '\0')
			if (*a++ == *s)
				return (char *) s;
			++s;
	}
	
	return NULL;
}

static void _main( void )
{
	char string[100] = "The 3 men and 2 boys ate 5 pigs\n";
	char *result;
	/* Return pointer to first 'a' or 'b' in "string" */
	printf( "1: %s\n", string );
	result = strpbrk( string, "0123456789" );

	printf( "2: %s\n", result++ );
	result = strpbrk( result, "0123456789" );

	printf( "3: %s\n", result++ );
	result = strpbrk( result, "0123456789" );
	printf( "4: %s\n", result );
}